#ifndef MAINWINDOW_H__
#define MAINWINDOW_H__

#include <gtkmm/window.h>
#include <gtkmm/treeview.h>
#include <gtkmm/liststore.h>
#include <gtkmm/button.h>
#include <gtkmm/label.h>
#include <gtkmm/statusbar.h>
#include <libglademm.h>

/// The main window of the application.  This window displays the schedules
/// generated, and provides means for iterating over these schedules.
class MainWindow : public Gtk::Window {
public:
	MainWindow(BaseObjectType*, const Glib::RefPtr<Gnome::Glade::Xml>&);
	virtual ~MainWindow();

protected:
	//Signal handlers:
	virtual void on_first();
	virtual void on_back();
	virtual void on_forward();
	virtual void on_last();
	virtual void on_register();
	virtual void on_constraints();
	virtual void on_quit();
	virtual bool on_delete_event(GdkEventAny*);

private:
	//Member widgets:
	Gtk::Button* first_button_;
	Gtk::Button* back_button_;
	Gtk::Button* forward_button_;
	Gtk::Button* last_button_;
	Gtk::Button* register_button_;
	Gtk::Button* constraints_button_;
	Gtk::Button* quit_button_;
	Gtk::Label* schedule_number_label_;
	Gtk::Label* schedule_count_label_;
	Gtk::TreeView* schedule_treeview_;
	Gtk::Statusbar* statusbar_;

	// the ModelColumns class describes the treeview's columns layout.
	// see the init_schedule_view() method.
	struct ModelColumns : public Gtk::TreeModel::ColumnRecord {
		ModelColumns() { add(name); add(number); add(type); }

		Gtk::TreeModelColumn<Glib::ustring> name;
		Gtk::TreeModelColumn<unsigned int> number;
		Gtk::TreeModelColumn<Glib::ustring> type;
	};

	// Helper methods
	void init_schedule_view();
};

#endif
